package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.core.VipCardDao;
import com.tbit.uqbike.client.pojo.VipCard;
import com.tbit.uqbike.client.service.VipCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: chen
 * @Description: 会员卡
 * @Date: 创建于 9:43 2020/7/7
 */
@Service
public class VipCardServiceImpl implements VipCardService {
    @Autowired
    private VipCardDao vipCardDao;

    @Override
    public List<VipCard> queryPage(Integer accountId, Integer pageNO, Integer rowCount) {
        Map<String, Object> map = new HashMap<>();
        map.put("accountId", accountId);
        map.put("page", (pageNO - 1) * rowCount);
        map.put("rowCount", rowCount);
        return vipCardDao.queryPage(map);
    }

    @Override
    public Integer queryCount(Integer accountId) {
        return vipCardDao.queryCount(accountId);
    }

    @Override
    public VipCard getById(Integer vipId) {
        return vipCardDao.getById(vipId);
    }

    @Override
    public VipCard getByAccountId(Integer accountId, Integer feeId) {
        Map<String, Object> map = new HashMap<>();
        map.put("accountId", accountId);
        map.put("feeId", feeId);
        return vipCardDao.getByAccountId(map);
    }
}
